# Which compiler
CC = gcc
AR = ar
AT = @

# Option for development
CFLAGS = -g -O2 -Wall
# Option for release
# CFLAGS = -O -Wall

LIBS := -lm
LIBS += -lpthread

OUTPUT = exec

MIDDLEWARE_PATH = ../..

# source file
SRCS := main.c
SRCS += ../dymem.c
SRCS += dymem_adapter.c


OBJS = $(SRCS:.c = .o)


# Where are include files kept
INCLUDES := -I./
INCLUDES += -I../
INCLUDES += -I${MIDDLEWARE_PATH}

INCLUDES += -DDYMEM_DEBUG_ENABLE
INCLUDES += -DDYMEM_ASSERT_ENABLE


all: $(OUTPUT)
	$(AT)echo "build done"

$(OUTPUT): $(OBJS)
	$(AT)$(CC) $^ -o $@ $(CFLAGS) $(INCLUDES) $(LIBS)

%.o: %.c
	$(AT)$(CC) -c $< $(CFLAGS)

.PHONY: clean
clean:
	$(AT)-rm -rf $(OUTPUT) *.o $(LUA_SRCS_PATH)/*.o

